$(function (){
    //加载默认隐藏展示页
    $(".show").hide()
    //单击后获取输入内容
    $(".btn").bind("click",function (){
        var text = $(".text").val();
        $.ajax({
            type: "post",
            url: "/nlp?action=address",
            data: {
                text: text
            },
            dataType: "json",
            success: function (data){
                var htmlStr = "";
                htmlStr += "<table>"
                htmlStr += "<tr>" +
                               "<td>省份：<span>"+data.province+"</span></td>" +
                            "<td>省编码：<span>"+data.province_code+"</span></td>" +
                            "</tr>"
                htmlStr += "<tr>" +
                            "<td>市区：<span>"+data.city+"</span></td>" +
                             "<td>市编码：<span>"+data.city_code+"</span></td>" +
                             "</tr>"
                htmlStr += "<tr>" +
                            "<td>县城：<span>"+data.county+"</span></td>" +
                             "<td>县编码：<span>"+data.county_code+"</span></td>" +
                            "</tr>"
                htmlStr += "<tr>" +
                            "<td>乡镇：<span>"+data.town+"</span></td>" +
                            "<td>镇编码：<span>"+data.town_code+"</span></td>" +
                            "</tr>"
                htmlStr += "<tr>" +
                            "<td>姓名：<span>"+data.person+"</span></td>" +
                            "<td>电话：<span>"+data.phonenum+"</span></td>" +
                            "</tr>"
                htmlStr += "<tr>" +
                    "<td colspan='2'>详细地址：<span>"+data.detail+"</span></td>" +
                    "</tr>"
                htmlStr += "</table>"
                $(".show").html(htmlStr)
            }
        })

        //单击后展示隐藏页面
        $(".show").show()
    })

})